package io;

import java.io.*;

/**
 *  对象流：
 *  java.io.ObjectInputStream和ObjectOutputStream
 */

public class OOSDemo implements Serializable {
    public static void main(String[] args) throws IOException {
        String name = "仓老师";
        int age = 12;
        String gender = "男";
        String[] otherInfo = {"技术好", "摄像一流"};
        Person p = new Person(name, age, gender, otherInfo);

        FileOutputStream fis = new FileOutputStream("./person.obj");
        ObjectOutputStream oos =  new ObjectOutputStream(fis);//对象流串联文件流

        oos.writeObject(p);//序列化
        System.out.println("写出完毕！");
        oos.close();
    }
}
